package com.dsbridge.enrollment.client;

import java.sql.Date;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.dsbridge.enrollment.dao.CourseDAO;
import com.dsbridge.enrollment.dao.StudentDAO;
import com.dsbridge.enrollment.model.CoursesDTO;
import com.dsbridge.enrollment.model.StudentsDTO;

public class SpringTestClient {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		//Instantiate the Spring Container
		ApplicationContext appContext=new ClassPathXmlApplicationContext("applicationContext.xml");
		//Then I wanted to get the instance of StudentDAO Spring Bean.
		StudentDAO studentDAO=appContext.getBean(StudentDAO.class);
		//Call the methods on the Object.
		//Create Dummy Studnet Object
		StudentsDTO studentsDTO=new StudentsDTO();
		studentsDTO.setFirstName("Venkat");
		studentsDTO.setLastName("Dulipalli");
		studentsDTO.setLoginName("venkatsep14");
		studentsDTO.setPassword("venka");
		studentsDTO.setRegistrationDate(new Date(new java.util.Date().getTime()));
		int i=studentDAO.create(studentsDTO);
		System.out.println("Returned From Student DAO:"+i);
		//Date Utilities..
		CourseDAO courseDAO=appContext.getBean(CourseDAO.class);
		CoursesDTO courseDTO=new CoursesDTO();
		courseDTO.setAuthorID(1);
		courseDTO.setSubjectID(1);
		courseDTO.setCourseName("Java");
		
		courseDAO.create(courseDTO);
		
	}

}
